﻿using System;

namespace Foothill.Web.Home
{
    public partial class Home : FoothillBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DisplayLoginPanelContent();
        }

        // show/hide content based on whether user is authenticated
        private void DisplayLoginPanelContent()
        {
            if (User.Identity.IsAuthenticated)
            {
                // display welcome 
                pnlLogin.Visible = false;
                pnlWelcome.Visible = true;
                SetupWelcomePanel();
            }
            else
            {
                // display login 
                pnlLogin.Visible = true;
                pnlWelcome.Visible = false;
            }
        }

        private void SetupWelcomePanel()
        {
            hlkWelcome.Text = User.Identity.Name;
            hlkWelcome.NavigateUrl = "~/UserProfile/User.aspx";
        }
    }
}
